#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

/**
 * This method runs in a child thread.
 * @param args
 * @return
 */
void *threadA_run(void *arg) {
  printf("thread A: %d start...\n", pthread_self());
  sleep(1000);
  printf("thread A: %d stop.\n", pthread_self());
  return NULL;
}

int main() {
  pthread_t threadA;  // This is a unsigned integer.You may understand as id or
                      // handle.
  pthread_t threadB;
  char *retval;
  char arg[128];
  pthread_create(&threadA, NULL, threadA_run, NULL);
  pthread_join(threadA, NULL);
  pthread_create(&threadB, NULL, threadA_run, NULL);
  pthread_join(threadB, NULL);
  printf("thread main stop.\n");
  return 0;
}
// g++ -o pthread pthread.cc -std=c++11